package com.yict.csms.company.entity;

import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.yict.csms.baseInfo.entity.ContractType;
import com.yict.csms.system.entity.User;
import com.yict.csms.system.entity.Wharf;

/**
 * 合同类别表Entity
 * 
 * @author Patrick.Deng
 * 
 */
@Entity
@Table(name = "CSMS_CONTRACT")
public class Contract {

	@Id
	@Column(name = "CONTRACTID")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "csms_contract_seq")
	@SequenceGenerator(name = "csms_contract_seq", sequenceName = "SEQ_CSMS_CONTRACT", allocationSize = 1, initialValue = 1)
	private Long contractId;

	@ManyToOne
	@JoinColumn(name = "COMPANYID")
	private Company company;
	
	@Column(name = "CONTRACTNO")
	private String contractNo;

	@ManyToOne
	@JoinColumn(name = "TYPEID")
	private ContractType contractType;
	
	@Column(name = "EFFECTIVEDATE")
	private Date effectiveDate;

	@Column(name = "EXPIRATIONDATE")
	private Date expirationDate;
	
	@Column(name = "WHARFID")
	private String wharf;
	
	@Column(name = "REMARKS")
	private String remarks;
	
	@Column(name = "CREATEDATE")
	private Date createDate;

	@Column(name = "UPDATEDATE")
	private Date updateDate;

	@ManyToOne
	@JoinColumn(name = "CREATEPERSON")
	private User createPerson;

	@ManyToOne
	@JoinColumn(name = "UPDATEPERSON")
	private User updatePerson;
	
	@OneToMany(mappedBy="contract", cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	@JoinColumn(name = "CONTRACTID")
	private Set<ContractRate> contractRateSet = new LinkedHashSet<ContractRate>();

	public Long getContractId() {
		return contractId;
	}

	public void setContractId(Long contractId) {
		this.contractId = contractId;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	public String getContractNo() {
		return contractNo;
	}

	public void setContractNo(String contractNo) {
		this.contractNo = contractNo;
	}

	public ContractType getContractType() {
		return contractType;
	}

	public void setContractType(ContractType contractType) {
		this.contractType = contractType;
	}

	public Date getEffectiveDate() {
		return effectiveDate;
	}

	public void setEffectiveDate(Date effectiveDate) {
		this.effectiveDate = effectiveDate;
	}

	public Date getExpirationDate() {
		return expirationDate;
	}

	public void setExpirationDate(Date expirationDate) {
		this.expirationDate = expirationDate;
	}

	public String getWharf() {
		return wharf;
	}

	public void setWharf(String wharf) {
		this.wharf = wharf;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public User getCreatePerson() {
		return createPerson;
	}

	public void setCreatePerson(User createPerson) {
		this.createPerson = createPerson;
	}

	public User getUpdatePerson() {
		return updatePerson;
	}

	public void setUpdatePerson(User updatePerson) {
		this.updatePerson = updatePerson;
	}

	public Set<ContractRate> getContractRateSet() {
		return contractRateSet;
	}

	public void setContractRateSet(Set<ContractRate> contractRateSet) {
		this.contractRateSet = contractRateSet;
	}
}
